package com.aiyige.page.publish.info.model;

import android.os.Parcel;
import android.os.Parcelable;

import com.aiyige.page.publish.info.adapter.PublishInfoAdapter;
import com.chad.library.adapter.base.entity.MultiItemEntity;

import java.io.Serializable;

/**
 * Created by zhuyakun on 2017/11/10.
 */

public class TextNode implements MultiItemEntity {
    public static final int TEXT_STYLE_BIG_TITLE = 1;
    public static final int TEXT_STYLE_SMALL_TITLE = 2;
    public static final int TEXT_STYLE_MAIN_BODY = 3;
    String text;
    int textStyle;
    int nodeType = PublishInfoAdapter.NODE_TYPE_TEXT;

    public TextNode() {
        text = "";
        textStyle = TEXT_STYLE_MAIN_BODY;
    }

    public TextNode(String text, int textStyle) {
        this.text = text;
        this.textStyle = textStyle;
    }

    private TextNode(Builder builder) {
        setText(builder.text);
        setTextStyle(builder.textStyle);
    }

    public static Builder newBuilder() {
        return new Builder();
    }

    public int getNodeType() {
        return nodeType;
    }

    public void setNodeType(int nodeType) {
        this.nodeType = nodeType;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public int getTextStyle() {
        return textStyle;
    }

    public void setTextStyle(int textStyle) {
        this.textStyle = textStyle;
    }

    @Override
    public int getItemType() {
        return nodeType;
    }


    public static final class Builder {
        private String text;
        private int textStyle;

        private Builder() {
            text = "";
            textStyle = TEXT_STYLE_MAIN_BODY;
        }

        public Builder text(String text) {
            this.text = text;
            return this;
        }

        public Builder textStyle(int textStyle) {
            this.textStyle = textStyle;
            return this;
        }

        public TextNode build() {
            return new TextNode(this);
        }
    }

}
